/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 张宇田
 * Date: 2025-04-01
 * Time: 10:28
 */
package test;
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        Stack<Character> st = new Stack<>();
        char[] ch = str.toCharArray();
        for (int i = 0; i<ch.length;i++){
            char x = ch[i];
            if(x == '('){
                st.push(x);
            }
            if(x == ')'&&){
                st.pop();
            }
        }

    }
    public static void main8(String[] args) {
        Scanner sc = new Scanner(System.in);
        Stack<Integer> st = new Stack<>();
        while(sc.hasNextInt()){
            int x = sc.nextInt();
            if (x == 0){
                break;
            }

            st.push(x);
        }
        while(!st.isEmpty()){
            int x = st.pop();
            System.out.print(x + " ");
        }


    }
    public static void main7(String[] args) {
        Stack<Integer> st = new Stack<>();
        st.push(1);
        st.push(1);
        st.push(1);
        System.out.println(st);
        //出栈
        int x = st.pop();
        System.out.println(st);

        int dd = st.peek();
        System.out.print(st.size());

    }
    public static void main6(String[] args) {
        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(3);
        System.out.println(list.size());
        System.out.println(list.get(2));
        System.out.println(list.contains(3));
        int x = list.remove(0);
        System.out.println(list);

    }
    //给定 n 个数，要求把其中重复的去掉，只保留第一次出现的数。
    public static void main5(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        for (int i = 0 ; i < T;i++){
            int n = sc.nextInt();
            Set<Integer> set = new HashSet<>();
            for (int j = 0 ; j< n;j++){
                int x = sc.nextInt();
                if (set.contains(x)){
                    continue;
                }
                System.out.print(x + " ");
                set.add(x);
            }
            System.out.println();
        }
        /*Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        for (int i = 0 ; i < T;i++){
            int n = sc.nextInt();
            Set<Integer> set = new HashSet<>();
            for (int j = 0 ; j< n;j++){
                set.add(sc.nextInt());
            }
            System.out.println(set);
        }*/

    }

    //哈希表练习 可以用来去重 元素是无序的
    public static void main4(String[] args) {
        Set<Integer> set = new HashSet<>();
        set.add(1);
        set.add(2);
        set.add(3);
        set.add(4);
        System.out.println(set.size());
        set.remove(4);
        System.out.println(set);
        System.out.println(set.size());
        System.out.println(set.contains(2));
        set.clear();
        System.out.println(set);




    }
    public static void main3(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n ; i++){
            arr[i] = sc.nextInt();
        }
        for(int i = n-1; i >= 0; i--){
            System.out.print(arr[i] + " ");
        }
    }
    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        System.out.println(A+B);
    }
    public static void main1(String[] args){
        int max = Integer.MAX_VALUE;
        System.out.println(max);
        Scanner sc = new Scanner(System.in);
        /*String cs= sc.next();
        int x = sc.nextInt();
        Float f = sc.nextFloat();
        long xm = 1000L;*/
        char[] ch = sc.nextLine().toCharArray();
        System.out.println(Arrays.toString(ch));
    }


}
